package com.cardone.platform.authority.service;

import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.UUID;


import lombok.Getter;


import lombok.Setter;

import org.apache.commons.beanutils.BeanUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.joda.time.DateTime;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.transaction.annotation.Transactional;

import com.cardone.common.dto.PaginationDto;
import com.cardone.common.cache.Caches;
import com.cardone.context.Attributes;
import com.cardone.context.ContextHolder;
import com.cardone.common.util.EntityUtils;
import com.cardone.platform.authority.dao.UsGroupRoleDao;
import com.cardone.platform.authority.dto.UsGroupRoleDto;

/**
 * 用户组与角色服务
 *
 * @author yaohaitao
 * 
 */
@Getter 
@Setter
@Transactional(readOnly = true)
public class UsGroupRoleDefaultService implements UsGroupRoleService {
	@Override
	@Transactional
	public <P> P saveByIdOrCode(Class<P> mappedClass, UsGroupRoleDto saveUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).saveByIdOrCode(mappedClass, saveUsGroupRole);
	}
	
	@Override
	@Transactional
	public UsGroupRoleDto saveByIdOrCode(UsGroupRoleDto saveUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).saveByIdOrCode(UsGroupRoleDto.class, saveUsGroupRole);
	}
	
	@Override
	public <P> P findByCodeOrId(Class<P> mappedClass, UsGroupRoleDto findUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).findByCodeOrId(mappedClass, findUsGroupRole);
	}
	
	@Override
	public Integer readByCodeNqIdForCount(UsGroupRoleDto readUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).readByCodeNqIdForCount(readUsGroupRole);
	}
	
	@Override
	@Transactional
	public int insertByCode(UsGroupRoleDto insertUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).insertByCode(insertUsGroupRole);
	}
	
	@Override
	@Transactional
	public int updateByCode(UsGroupRoleDto updateUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).updateByCode(updateUsGroupRole);
	}

	@Override
	@Transactional
	public int deleteByIds(UsGroupRoleDto deleteUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).deleteByIds(deleteUsGroupRole);
	}

	@Override
	public <P> P findById(Class<P> mappedClass, UsGroupRoleDto findUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).findById(mappedClass, findUsGroupRole);
	}

	@Override
	public <P> List<P> findListByLikeCode(Class<P> mappedClass, UsGroupRoleDto findListUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).findListByLikeCode(mappedClass, findListUsGroupRole);
	}

	@Override
	public <P> List<P> findList(Class<P> mappedClass) {
		return ContextHolder.getBean(UsGroupRoleDao.class).findList(mappedClass);
	}

	@Override
	public <P> PaginationDto<P> paginationByLikeCode(Class<P> mappedClass, UsGroupRoleDto paginationUsGroupRole) {
		return ContextHolder.getBean(UsGroupRoleDao.class).paginationByLikeCode(mappedClass, paginationUsGroupRole);
	}
}